package cn.shopifymall.spring;

import cn.shopifymall.spring.config.TxConfig;
import cn.shopifymall.spring.service.UserService;
import cn.shopifymall.spring.util.MathCalculator;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author 孤风雪影
 * @Email gitee.com/efairy520
 * @Date 2024/12/28 5:47
 * @Version 1.0
 */
public class application {
    public static void main(String[] args) {
        //输出cglib代理对象源码
        //System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "D:\\Develop\\IdeaProject\\studying\\spring\\src\\proxy");

        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(TxConfig.class);
        UserService userService = annotationConfigApplicationContext.getBean(UserService.class);
        System.out.println(userService.getClass());
        MathCalculator mathCalculator = annotationConfigApplicationContext.getBean(MathCalculator.class);
        //此处不能直接打印对象，内部对toString方法重写了，永远都是原始对象的类型
        System.out.println(mathCalculator.getClass());
        int division = mathCalculator.division(8, 2);
        System.out.println("division = " + division);

        //userService.insert();
    }
}
